// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import axios from "axios"
import "./lib/mui/css/mui.css"
import "./lib/mui/css/icons-extra.css"

Vue.prototype.$axios = axios
axios.defaults.baseURL = "http://www.liulongbin.top:3005/api/";
axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded';

import MintUI from "mint-ui"
import "mint-ui/lib/style.css";
Vue.use(MintUI);

import VuePreview from "vue-preview";
Vue.use(VuePreview);
Vue.use(VuePreview, {
  mainClass: "pswp--minimal--dark",
  barsSize: { top: 0, bottom: 0 },
  captionEl: false,
  fullscreenEl: false,
  shareEl: false,
  bgOpacity: 0.85,
  tapToClose: true,
  tapToToggleControls: false
});

Vue.config.productionTip = false
//格式化时间的库
import moment from 'moment'
//定义全局的过滤器
Vue.filter('dateFormat',function(datestr,patten='YYYY-MM-DD HH:mm:ss'){
  return moment(datestr).format(patten)
})
Vue.filter('substr', function (str,len=20,txt='...') {
  let s = str
  if (str.length > len){
    s= str.substring(0, len)+txt
  }
  return s
  
})

/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  components: { App },
  template: '<App/>'
})
